package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.testDeal.domain.equInfo.JkKyjInfo;
import com.ruoyi.testDeal.service.IJkKyjInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 非煤空压机铭牌参数Controller
 * 
 * @author ruoyi
 * @date 2024-04-03
 */
@RestController
@RequestMapping("/testDeal/jkKyjInfo")
public class JkKyjInfoController extends BaseController
{
    @Autowired
    private IJkKyjInfoService jkKyjInfoService;

    /**
     * 查询非煤空压机铭牌参数列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkKyjInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(JkKyjInfo jkKyjInfo)
    {
        startPage();
        List<JkKyjInfo> list = jkKyjInfoService.selectJkKyjInfoList(jkKyjInfo);
        return getDataTable(list);
    }

    /**
     * 导出非煤空压机铭牌参数列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkKyjInfo:export')")
    @Log(title = "非煤空压机铭牌参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkKyjInfo jkKyjInfo)
    {
        List<JkKyjInfo> list = jkKyjInfoService.selectJkKyjInfoList(jkKyjInfo);
        ExcelUtil<JkKyjInfo> util = new ExcelUtil<JkKyjInfo>(JkKyjInfo.class);
        util.exportExcel(response, list, "非煤空压机铭牌参数数据");
    }

    /**
     * 获取非煤空压机铭牌参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkKyjInfo:query')")
    @GetMapping(value = "/{kyjId}")
    public AjaxResult getInfo(@PathVariable("kyjId") Long kyjId)
    {
        return success(jkKyjInfoService.selectJkKyjInfoByKyjId(kyjId));
    }

    /**
     * 新增非煤空压机铭牌参数
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkKyjInfo:add')")
    @Log(title = "非煤空压机铭牌参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkKyjInfo jkKyjInfo)
    {
        return toAjax(jkKyjInfoService.insertJkKyjInfo(jkKyjInfo));
    }

    /**
     * 修改非煤空压机铭牌参数
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkKyjInfo:edit')")
    @Log(title = "非煤空压机铭牌参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkKyjInfo jkKyjInfo)
    {
        return toAjax(jkKyjInfoService.updateJkKyjInfo(jkKyjInfo));
    }

    /**
     * 删除非煤空压机铭牌参数
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkKyjInfo:remove')")
    @Log(title = "非煤空压机铭牌参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{kyjIds}")
    public AjaxResult remove(@PathVariable Long[] kyjIds)
    {
        return toAjax(jkKyjInfoService.deleteJkKyjInfoByKyjIds(kyjIds));
    }
}
